import {
    BrowserRouter as Router,
    Route,
    Switch,
    Redirect,
} from 'react-router-dom'
// 导入页面组件
import Login from './pages/Login'
import Layout from './pages/Layout'
import NotFound from './pages/NotFound'
import { AuthRoute } from '@/components/AuthRoute'
import './App.scss'

const App = () => {
    return (
        <Router>
            <div className="App">
                <Switch>
                    {/* 默认路由 */}
                    <Route
                        exact
                        path="/"
                        render={() => <Redirect to="/home" />}
                    />
                    {/* 主页面 */}
                    {/* <Route path="/home" component={Layout} /> */}
                    <AuthRoute path="/home" component={Layout}></AuthRoute>
                    {/* 登录页面 */}
                    <Route path="/login" component={Login} />
                    {/* 404 */}
                    <Route component={NotFound} />
                </Switch>
            </div>
        </Router>
    )
}

export default App
